package dale.web.common.model;

import java.io.Serializable;

import seo.dale.util.database.LikeSearchUtils;
import dale.web.common.Constants;

public class Condition<T> implements Serializable {
	
    private static final long serialVersionUID = 1L;
    
    private Integer pageNo;
    private Integer listSize;
    private Integer blockSize;
    
    private String query;
    
    private T detail;
    
	public Condition() {
		pageNo = Constants.DEFAULT_PAGE_NO;
		listSize = Constants.DEFAULT_LIST_SIZE;
		blockSize = Constants.DEFAULT_BLOCK_SIZE;
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		if (pageNo != null && pageNo > 0) {
			this.pageNo = pageNo;
		}
	}

	public Integer getListSize() {
		return listSize;
	}

	public void setListSize(Integer listSize) {
		if (listSize != null && listSize > 0) {
			this.listSize = listSize;
		}
	}

	public Integer getBlockSize() {
		return blockSize;
	}

	public void setBlockSize(Integer blockSize) {
		if (blockSize != null && blockSize > 0) {
			this.blockSize = blockSize;
		}
	}

	public String getQuery() {
		return query;
	}

	public void setQuery(String query) {
		this.query = query;
	}
	
	public String getLikeQuery() {
		return LikeSearchUtils.forLikeSearch(query); 
	}
	
	public T getDetail() {
		return detail;
	}

	public void setDetail(T detail) {
		this.detail = detail;
	}

}
